﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using eCRAM.WebSite.Tools;

namespace eCRAM.WebSite.Models
{
    public enum EnumDataType
    {
        [Display(Name = "Activités")]
        Activites = 1,
        [Display(Name = "Utilisateurs")]
        Utilisateurs,
        [Display(Name = "Paramètres")]
        Parametres,
        [Display(Name = "Export des crams")]
        ExportCram,
    }

    public class ReferentialsDataModel
    {
        /// <summary>
        /// Type de données de référence à afficher
        /// </summary>
        public int DataType { get; set; }

        public string Label { get; set; }
        public string AddActionName { get; set; }
        public string AddActionLabel { get; set; }

        public IEnumerable<T> GetData<T>()
        {
            return Data as IEnumerable<T>;
        }

        public TableDescription<T> GetTableDescription<T>()
        {
            return TableDescription as TableDescription<T>;
        }

        public object TableDescription { get; set; }

        public void SetTableDescription<T> (TableDescription<T> tableDescription)
        {
            TableDescription = tableDescription;
        }

        public IEnumerable Data { get; set; }

        public void SetData<T> (IEnumerable<T> data)
        {
            Data = data;
        }

    }
}